<?php
// ----- >> Extends From Template
class thisPDF extends PDF{
	function Header(){}
	function Footer(){}
}


// ----- >> Init
$fpdf = new thisPDF('P','mm','A4');
$fpdf->AddPage();
$fpdf->SetLeftMargin(8);

$fpdf->Ln(0);
$ln_header_y_top	= $fpdf->GetY();


// ----- >> Header
$fpdf->Ln(2);

$fpdf->SetFont('Arial','B',14);
$fpdf->Cell(0,5,"JUDUL REPORT",0,1,'C');

$fpdf->Ln(10);



// ----- >> Data Master
$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Primary Key",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,$data['pk_master'],0,0,'L');

$fpdf->Cell(20,5,"Field 1",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(20,5,$data['field1'],0,1,'L');



$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Field 2",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,date_format3($data['field2'],'DD MONTH YYYY'),0,0,'L');

$fpdf->Cell(20,5,"Field 3",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(20,5,date_format3($data['field3'],'DD MONTH YYYY'),0,1,'L');



$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Field 4",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,numberDisplay($data['field4'],2),0,0,'L');

$fpdf->Cell(20,5,"Field 5",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(20,5,numberDisplay($data['field5'],5),0,1,'L');

$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Field 6",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,$data['field6'],0,0,'L');

$fpdf->Cell(20,5,"Field 7",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->MultiCell(20,5,$data['field7'],0,'L');



// ----- >> Detail 1
$fpdf->Ln(10);
$fpdf->SetFont('Arial','B',10);
$fpdf->Cell(25,5,'Tgl Field',1,0,'C');
$fpdf->Cell(0,5,'Keterangan',1,1,'C');
$fpdf->SetFont('Arial','',10);
for($i=0, $max_i=count($arr_detail1); $i<$max_i; $i++){
	$row = $arr_detail1[$i];
	
	$fpdf->Cell(25,5,date_format3($row['tgl_field'],'DD/MM/YYYY'),1,0,'L');
	$fpdf->Cell(0,5,$row['keterangan'],1,1,'L');
}


// ----- >> Detail 2
$fpdf->Ln(10);
$fpdf->SetFont('Arial','B',10);
$fpdf->Cell(27,5,'ref_key_combo',1,0,'C');
$fpdf->Cell(40,5,'ref_name_combo',1,0,'C');
$fpdf->Cell(27,5,'ref_key_lov',1,0,'C');
$fpdf->Cell(40,5,'ref_name_lov',1,0,'C');
$fpdf->Cell(0,5,'Keterangan',1,1,'C');
$fpdf->SetFont('Arial','',8);
for($i=0, $max_i=count($arr_detail2); $i<$max_i; $i++){
	$row = $arr_detail2[$i];
	
	$fpdf->Cell(27,5,$row['ref_key_combo'],1,0,'L');
	$fpdf->Cell(40,5,$row['ref_name_combo'],1,0,'L');
	$fpdf->Cell(27,5,$row['ref_key_lov'],1,0,'L');
	$fpdf->Cell(40,5,$row['ref_name_lov'],1,0,'L');
	$fpdf->Cell(0,5,$row['keterangan'],1,1,'L');
}


echo $fpdf->Output('CetakSample.pdf', 'I');
exit();
?>